﻿using System;

/// <summary>
/// BasePage 的摘要说明
/// </summary>
public class BasePage : ContainerBasePage
{
    /// <summary>
    /// 校园版登陆页面
    /// </summary>
    private const string SchoolUrl = "SchLogin.aspx";

    /// <summary>
    /// 教育局版登陆页面
    /// </summary>
    private const string EducationUrl = "EduLogin.aspx";

    protected override void OnInit(EventArgs e)
    {
        string url = Request.Url.ToString();
        string pageUrl = url.Split(new char[] {'/', '\\'})[url.Split(new char[] {'/', '\\'}).Length - 1];

        switch (Common.CurrentVersion)
        {
            case EduVersion.School:
                if (pageUrl != SchoolUrl)
                    Response.Redirect(SchoolUrl);
                break;
            case EduVersion.Education:
                if (pageUrl != EducationUrl)
                    Response.Redirect(EducationUrl);
                break;
        }
    }
}

/// <summary>
/// 版本
/// </summary>
public enum EduVersion
{
    /// <summary>
    /// 校园版
    /// </summary>
    School = 0,

    /// <summary>
    /// 教育局版
    /// </summary>
    Education = 1
}